#include<stdio.h>
struct tian
{
	int year;
	int month;
	int day;
};
int days(int year,int month,int day)
{int s=0,i,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
 if(year%4==0&&year%100!=0||year%400==0)
 a[2]=29; 
 for(i=1;i<month;i++)
 s+=a[i];
 s=s+day;
 return s;
 }
  int main(void)
  {int k=0;
  struct tian a;
  scanf("%d%d%d",&a.year,&a.month,&a.day);
  k=days(a.year,a.month,a.day);
  printf("%d\n",k);
   } 

